<?php
function get_media_type($media_type) {
	$media_type_name = "";
	if ($media_type == "common") {
		$media_type_name = "市区大牌";
	} elseif ($media_type == "highway") {
		$media_type_name = "高速大牌";
	} elseif ($media_type == "led") {
		$media_type_name = "LED大屛";
	} elseif ($media_type == "airport") {
		$media_type_name = "机场大牌";
	}
	return $media_type_name;
}
function format_media_specification($specification_width, $specification_height) {
	$width_list = explode ( "+", $specification_width );
	$height_list = explode ( "+", $specification_height );
	$num = count ( $width_list );
	$width = floatval ( $width_list [0] );
	$height = floatval ( $height_list [0] );
	return $width . "米 × " . $height . "米 × " . $num . "面";
}
function get_illumination($illumination) {
	if ($illumination == 1) {
		return "有";
	} else {
		return "无";
	}
}
function get_env_name($env_type) {
	$env_name = "";
	switch ($env_type) {
		case "circle" :
			$env_name = "市区商圈";
			break;
		case "road" :
			$env_name = "市区主干道";
			break;
		case "market" :
			$env_name = "专业市场";
			break;
		case "venues" :
			$env_name = "大型场馆";
			break;
		case "station" :
			$env_name = "火车站";
			break;
		case "stop" :
			$env_name = "汽车站";
			break;
		case "cbd" :
			$env_name = "CBD中心";
			break;
		case "chief_district" :
			$env_name = "政务区";
			break;
		case "industrial" :
			$env_name = "工业区";
			break;
		case "highway" :
			$env_name = "高速公路";
			break;
		case "airport" :
			$env_name = "机场";
			break;
	}
	return $env_name;
}
function get_flow_name($flow) {
	$flow_name = "";
	if ($flow == "10") {
		$flow_name = "极大";
	} elseif ($flow == "20") {
		$flow_name = "较大";
	} elseif ($flow == "30") {
		$flow_name = "一般";
	} elseif ($flow == "40") {
		$flow_name = "较小";
	}
	return $flow_name;
}
function format_env_detail($env_type, $env_info) {
	$env_string = "";
	if ($env_info != "") {
		if ($env_type == "circle") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td width="100px">商圈级别</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$level = "";
			if ($env_info ['level'] == 10) {
				$level = "一级商圈";
			} elseif ($env_info ['level'] == 20) {
				$level = "次级商圈";
			} elseif ($env_info ['level'] == 30) {
				$level = "一般商圈";
			}
			$env_string .= '<td class="center"><div class="level">' . $level . '</div></td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">所属位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">途经主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">大型购物中心：</td><td>' . $env_info ['market'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">其他大型门店：</td><td>' . $env_info ['shopping_store'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边大型写字楼：</td><td>' . $env_info ['office'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边高校：</td><td>' . $env_info ['college'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">地铁枢纽：</td><td>' . $env_info ['subway_station'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边四星级以上酒店：</td><td>' . $env_info ['hotel'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边大型医院：</td><td>' . $env_info ['hospital'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边大型社区：</td><td>' . $env_info ['community'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主要受众：</td><td>' . $env_info ['env_desc'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "road") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td width="100px">道路级别</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$level = "";
			if ($env_info ['level'] == 10) {
				$level = "核心主干道";
			} elseif ($env_info ['level'] == 20) {
				$level = "一般主干道";
			} elseif ($env_info ['level'] == 30) {
				$level = "次干道";
			}
			$env_string .= '<td class="center"><div class="level">' . $level . '</div></td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">道路起始位置：</td><td>' . $env_info ['starting_position'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">道路全长：</td><td>' . $env_info ['road_length'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">途径商圈：</td><td>' . $env_info ['circle'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">途径大型购物中心：</td><td>' . $env_info ['market'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">途径专业市场：</td><td>' . $env_info ['professional_market'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">途径四星级以上酒店：</td><td>' . $env_info ['hotel'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">途径大型医院：</td><td>' . $env_info ['hospital'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">沿线高校：</td><td>' . $env_info ['college'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">沿线大型写字楼：</td><td>' . $env_info ['office'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">沿线大型场馆：</td><td>' . $env_info ['venues'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">沿线旅游景点：</td><td>' . $env_info ['attractions'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">沿线大型社区：</td><td>' . $env_info ['community'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">沿线地铁站：</td><td>' . $env_info ['subway_station'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "market") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td width="100px">市场规模</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$level = "";
			if ($env_info ['level'] == 10) {
				$level = "大型";
			} elseif ($env_info ['level'] == 20) {
				$level = "一般";
			}
			$env_string .= '<td class="center"><div class="level">' . $level . '</div></td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">具体位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">市场头衔：</td><td>' . $env_info ['title'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">地铁枢纽：</td><td>' . $env_info ['subway_station'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主要受众：</td><td>' . $env_info ['env_desc'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "station") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td width="100px">列车类型</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$level = "";
			if (stristr($env_info ['level'],10)) {
				$level .= "高铁 ";
			} elseif (stristr($env_info ['level'],20))  {
				$level .= "动车 ";
			}elseif (stristr($env_info ['level'],30))  {
				$level .= "普通列车 ";
			}
			$env_string .= '<td class="center"><div class="level">' . $level . '</div></td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">具体位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">发车范围：</td><td>' . $env_info ['departure_range'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边汽车站：</td><td>' . $env_info ['stops'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "stop") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">具体位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">发车范围：</td><td>' . $env_info ['departure_range'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边汽车站：</td><td>' . $env_info ['stops'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "venues") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">具体位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">举办的赛事/活动：</td><td>' . $env_info ['event'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "cbd") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">具体位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主要建筑：</td><td>' . $env_info ['building'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">大型企业：</td><td>' . $env_info ['enterprise'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">四星级以上酒店：</td><td>' . $env_info ['hotel'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">地铁枢纽：</td><td>' . $env_info ['subway_station'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "chief_district") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">具体位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主要政府单位：</td><td>' . $env_info ['government_units'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">四星级以上酒店：</td><td>' . $env_info ['hotel'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">地铁枢纽：</td><td>' . $env_info ['subway_station'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "industrial") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['env_name'] . '</td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">具体位置：</td><td>' . $env_info ['location'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">工业区面积：</td><td>' . $env_info ['industrial_area'] . ' 平米</td></tr>';
			$env_string .= '<tr><td class="info_title">产业性质：</td><td>' . $env_info ['industrial_nature'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">企业数量：</td><td>' . $env_info ['enterprise_num'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">大型企业：</td><td>' . $env_info ['enterprise'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">途经工业区的主干道：</td><td>' . $env_info ['main_road'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">周边大型购物中心：</td><td>' . $env_info ['market'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">其他大型门店：</td><td>' . $env_info ['shopping_store'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		} elseif ($env_type == "highway") {
			$env_string .= '<table>';
			$env_string .= '<thead>';
			$env_string .= '<tr>';
			$env_string .= '<td width="120px">隶属环境</td>';
			$env_string .= '<td>传播环境分析</td>';
			$env_string .= '</tr>';
			$env_string .= '</thead>';
			$env_string .= '<tbody>';
			$env_string .= '<tr>';
			$env_string .= '<td class="center">' . $env_info ['highway_name'] . '</td>';
			$env_string .= '<td>';
			$env_string .= '<table>';
			$env_string .= '<tr><td class="info_title">高速编号：</td><td>' . $env_info ['highway_num'] . '</td></tr>';
			$env_string .= '<tr><td class="info_title">高速里程：</td><td>' . $env_info ['highway_length'] . ' 平米</td></tr>';
			$env_string .= '<tr><td class="info_title">途径区域：</td><td>' . $env_info ['along_area'] . '</td></tr>';
			$env_string .= '</tr>';
			$env_string .= '</table>';
			$env_string .= '</td>';
			$env_string .= '</tr>';
			$env_string .= '</tbody>';
			$env_string .= '</table>';
		}
	} else {
		$env_string = "暂无数据";
	}
	return $env_string;
}
?>